package com.push.web.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.push.common.annotation.Log;
import com.push.common.core.controller.BaseController;
import com.push.common.core.domain.AjaxResult;
import com.push.common.enums.BusinessType;
import com.push.web.domain.BizBibAffi;
import com.push.web.service.IBizBibAffiService;
import com.push.common.utils.poi.ExcelUtil;
import com.push.common.core.page.TableDataInfo;

/**
 * 标准单位Controller
 *
 * @author push
 * @date 2022-10-10
 */
@RestController
@RequestMapping("/intelligence/bibAffi")
public class BizBibAffiController extends BaseController
{
    @Autowired
    private IBizBibAffiService bizBibAffiService;

    /**
     * 查询标准单位列表
     */
    @PreAuthorize("@ss.hasPermi('intelligence:bibAffi:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizBibAffi bizBibAffi)
    {
        startPage();
        List<BizBibAffi> list = bizBibAffiService.selectBizBibAffiList(bizBibAffi);
        return getDataTable(list);
    }

    /**
     * 导出标准单位列表
     */
    @PreAuthorize("@ss.hasPermi('intelligence:bibAffi:export')")
    @Log(title = "标准单位", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BizBibAffi bizBibAffi)
    {
        List<BizBibAffi> list = bizBibAffiService.selectBizBibAffiList(bizBibAffi);
        ExcelUtil<BizBibAffi> util = new ExcelUtil<BizBibAffi>(BizBibAffi.class);
        return util.exportExcel(list, "标准单位数据");
    }

    /**
     * 获取标准单位详细信息
     */
    @PreAuthorize("@ss.hasPermi('intelligence:bibAffi:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(bizBibAffiService.selectBizBibAffiById(id));
    }

    /**
     * 新增标准单位
     */
    @PreAuthorize("@ss.hasPermi('intelligence:bibAffi:add')")
    @Log(title = "标准单位", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizBibAffi bizBibAffi)
    {
        return toAjax(bizBibAffiService.insertBizBibAffi(bizBibAffi));
    }

    /**
     * 修改标准单位
     */
    @PreAuthorize("@ss.hasPermi('intelligence:bibAffi:edit')")
    @Log(title = "标准单位", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizBibAffi bizBibAffi)
    {
        return toAjax(bizBibAffiService.updateBizBibAffi(bizBibAffi));
    }

    /**
     * 删除标准单位
     */
    @PreAuthorize("@ss.hasPermi('intelligence:bibAffi:remove')")
    @Log(title = "标准单位", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(bizBibAffiService.deleteBizBibAffiByIds(ids));
    }


}
